﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="fsw.Web.Login" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <title>管理员登录</title>
    <link rel="stylesheet" href="/public/css/amazeui.min.css" />
    <link rel="stylesheet" href="/public/admin/css/layout.css" />
    <link rel="stylesheet" href="/public/admin/css/toastr.css" />
    <script src="/public/js/jquery.min.js"></script>
    <script src="/public/js/amazeui.min.js"></script>
    <script src="/public/admin/js/toastr.min.js"></script>
    <script src="/public/validator/jquery.validator.min.js?local=zh-CN"></script>
    <!--[if lt IE 9]>
    <script src="/public/js/html5shiv.js"></script>
    <script src="/public/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="bg-login">
    <div class="ui-login am-animation-scale-up">
        <div class="logo">
            <img src="" />
        </div>
        <form id="form_login" runat="server">
            <div class="group">
                <asp:TextBox ID="t0" CssClass="am-form-field am-radius" placeholder="请输入用户名" data-rule="用户名:required;username;" runat="server"></asp:TextBox>
                <em class="am-icon-user am-icon-fw"></em>
            </div>
            <div class="group">
                <asp:TextBox ID="t1" TextMode="Password" CssClass="am-form-field am-radius" placeholder="请输入密码" data-rule="密码:required;password;" runat="server"></asp:TextBox>
                <em class="am-icon-lock am-icon-fw"></em>
            </div>
            <div class="group">
                <input type="text" name="t2" id="t2" placeholder="请输入验证码" class="am-form-field am-radius" data-rule="验证码:required;" /><em class="am-icon-ticket am-icon-fw"></em>
                <img src="VerifyCode.aspx" title="点击更换验证码" />
            </div>

            <div class="group">
                <asp:Button ID="btnSubmit" runat="server" Text="登录" CssClass="am-btn am-btn-primary am-btn-block am-radius" />
            </div>
        </form>
        <div id="myContainer"></div>
        <div class="am-text-center am-text-xs am-animation-slide-bottom am-animation-delay-1">
            Copyright © 2013-2019 卡片管理系统 All Rights Reserved.<br />
            建议在至少1280*1024分辨率下使用
        </div>
    </div>
    <script>
        $(function () {
            toastr.options = { "positionClass": "toast-top-center", "timeOut": "3000", "onclick": null, showMethod: "slideDown", hideMethod: "slideUp" };
            $("img").click(function () {
                var img = $(this).attr("src");
                if (img.indexOf('?') > 0) {
                    $(this).attr("src", img + '&random=' + Math.random());
                }
                else {
                    $(this).attr("src", img.replace(/\?.*$/, '') + '?' + Math.random());
                }
                $("#t2").val("");
            });

            $('#form_login').validator({
                timely: 2,
                stopOnError: true,
                focusCleanup: true,
                ignore: ':hidden',
                theme: 'yellow_right_effect',
                valid: function (form) {
                    $.AMUI.progress.inc();
                    $.ajax({
                        type: 'post',
                        cache: false,
                        dataType: 'json',
                        url: '/login.aspx',
                        data: $(form).serialize(),
                        error: function (e) { alert(e.responseText); },
                        success: function (d) {
                            $.AMUI.progress.set(1.0);
                            if (d.state == 'success') {
                                toastr.success(d.msg);
                                setTimeout(function () { location.href = '/'; }, 1500);
                            }
                            else {
                                toastr.error(d.msg);
                            }
                        }
                    })
                }
            });
        })
</script>
</body>
</html>
